<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right" style="font-size: 16px;">
      <el-breadcrumb-item :to="{ path: '/' }">后台管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
    </el-breadcrumb>



    <el-divider></el-divider>
    <el-form :inline="true" :model="select1" class="demo-form-inline">
      <el-form-item label="订单编号">
        <el-input v-model="select1.id" placeholder="订单编号"></el-input>
      </el-form-item>
      <el-form-item label="购买用户">
        <el-input v-model="select1.phone" placeholder="购买用户"></el-input>
      </el-form-item>
      <el-form-item label="状态">
        <el-input v-model="select1.state" placeholder="0-1-2-3-4"></el-input>
      </el-form-item>
      <el-form-item label="金额最小值">
        <el-input v-model="select1.MinMoney" placeholder="金额最小值"></el-input>
      </el-form-item>
      <el-form-item label="金额最大值">
        <el-input v-model="select1.MaxMoney" placeholder="金额最大值"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button  type="primary" @click="selectLikeGoods(select1)">查询</el-button>
      </el-form-item>
    </el-form>



    <el-divider></el-divider>

    <el-table
        :data="tableData"
        border
        style="width: 100%">
      <el-table-column prop="id" label="订单编号" width="50px" align="center"></el-table-column>
      <el-table-column prop="uphone" label="购买用户" width="150" align="center"></el-table-column>
      <el-table-column prop="money" label="金额" width="50" align="center"></el-table-column>
      <el-table-column prop="detailed" label="收货地址" width="150" align="center"></el-table-column>
<!--      <el-table-column prop="addressId" label="收货地址编号" width="150" align="center"></el-table-column>-->
      <el-table-column prop="name" label="收货人" width="150" align="center"></el-table-column>
      <el-table-column prop="phone" label="联系电话" width="150" align="center"></el-table-column>
      <el-table-column prop="state" label="当前订单状态" width="50" align="center"></el-table-column>
      <el-table-column prop="createTime" label="创建时间" width="100" align="center"></el-table-column>
      <el-table-column prop="paymentTime" label="支付时间" width="100" align="center"></el-table-column>
      <el-table-column prop="sendTime" label="发货时间" width="100" align="center"></el-table-column>
      <el-table-column prop="furlTime" label="收货时间" width="100" align="center"></el-table-column>

      <el-table-column label="操作" width="220" align="center">
        <template slot-scope="scope">
<!--          <el-button type="primary" icon="el-icon-edit" circle size="mini" @click="handleEdit(scope.row)"></el-button>-->
          <el-button type="info"  round size="mini" @click="selectGoods(scope.row)">查看订单对应的商品</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>
<script>
import axios from "axios";

export default {
  data() {
    return {
      tableData: [],
      pack:{id:1,name:11},
      select1:{
        MinMoney:1,
        MaxMoney:9999
      },
      pack1:{name:11},
      ruleForm: {

      },

    }
  },
  methods:{
    selectLikeGoods(select1){
      let s=this.qs.stringify(this.select1)
      console.log("模糊查询select1=",s)
      let url='http://localhost:8080/adminorders/selectLikeOrders';
      this.axios.post(url,s).then((response)=>{
        let responseBody=response.data;
        if(responseBody.state==20000){
          this.tableData=responseBody.data;
          this.$message({
            type: 'success',
            message: "查询成功"
          });
        }else {
          this.$message({
            type: 'info',
            message: responseBody.message
          });
        }
      })
    },
    selectGoods(row){
      let id=row.id;
      console.log("id=",id)
      localStorage.setItem("id",id);
    this.$router.push('/orders1-1');
    },
    loadGoodsList(){
      console.log('packlist')
      let url='http://localhost:8080/adminorders/list';
      console.log('url='+url);
      this.axios.get(url).then((response)=>{
        let responseBody=response.data;
        this.tableData=responseBody.data;
      })
    }
  },
  mounted() {//挂载
    console.log('mounted')
    this.loadGoodsList();
  }

}
</script>